
/**
 *  @type Logic Component
 *  @role 用于页面footer部分card集合[main]
 *  @createDate Mr.Liu on 2017.06.02.14:59
 */

import React from "react";
import Card from './View_Card';

import No_orders from '../img/No_orders.png';

export default class CardMain extends React.Component {
    constructor(props) {
        super(props);
        this.state = {

        }
    }

    // 卡片右侧title标签 映射关系表
    labelFilter(orderType){
        if(!orderType || typeof orderType != "number"){ return; }
        switch (orderType){
            case 4 : return {title:"印染",color:"92cf67"};
            case 5 : return {title:"纱线",color:"eccc55"};
            case 2 : return {title:"辅料",color:"36acde"};
            case 3 : return {title:"面料",color:"ee6666"};
            default :
                return {title:"",color:""}
        }
    }

    render() {
        const data = this.props.data;

        return <div className="order_upDownStream_section">
            {
                data.length <= 0 ? <div className="order_upDownStream_section_empty">
                    <img src={No_orders} />
                </div> : <ul className="order_upDownStream_cardList">
                    {
                        Array.isArray(data) && data.map((item,index)=>
                            <li>
                                <Card
                                    labelInfo={this.labelFilter(item.orderType)}
                                    data={item}
                                />
                            </li>
                        )
                    }
                </ul>
            }

        </div>
    }

}